package com.local.runnable.RunnableDmeo;

public class RunnableDemo {
       public static void main(String[] args) {
//		Thread t1 = new Thread(new BuyTickey());
//		Thread t2 = new Thread(new BuyTickey());
//		Thread t3 = new Thread(new BuyTickey());
//		Thread t4 = new Thread(new BuyTickey());
//		Thread t5 = new Thread(new BuyTickey());
//		
//		t1.start();
//		t2.start();
//		t3.start();
//		t4.start();
//		t5.start();
    	   BuyTickey b = new BuyTickey(new Tickey(200));//系统里假定有200张票
    	   System.out.println("买票开始");
    	   //线程同时启动，谁快就谁先得
    	   new Thread(b,"电脑1").start();
    	   new Thread(b,"电脑2").start();
    	   new Thread(b,"电脑3").start();
    	   new Thread(b,"电脑4").start();
    	   new Thread(b,"电脑5").start();
    	   new Thread(b,"电脑6").start();
    	   new Thread(b,"电脑7").start();
    	   new Thread(b,"电脑8").start();
    	   new Thread(b,"电脑9").start();
    	   new Thread(b,"电脑10").start();
    	   new Thread(b,"电脑11").start();
    	   new Thread(b,"电脑12").start();
    	   new Thread(b,"电脑13").start();
    	   new Thread(b,"电脑14").start();
    	   new Thread(b,"电脑15").start();
    	   new Thread(b,"电脑16").start();
    	   new Thread(b,"电脑17").start();
    	   new Thread(b,"电脑18").start();
    	   new Thread(b,"电脑19").start();
    	   new Thread(b,"电脑20").start();
    	   
    	   
    	   
    	   BuyTickey c = new BuyTickey(new Tickey(200));//再另启动200张
    	   System.out.println("工作台服务");
    	   //线程同时启动，谁快就谁先得
    	   new Thread(c,"工作台1").start();
    	   new Thread(c,"工作台2").start();
    	   new Thread(c,"工作台3").start();
    	   new Thread(c,"工作台4").start();
    	   new Thread(c,"工作台5").start();
    	   new Thread(c,"工作台6").start();
    	   new Thread(c,"工作台7").start();
    	   new Thread(c,"工作台8").start();
    	   new Thread(c,"工作台9").start();
    	   new Thread(c,"工作台10").start();

    	   
    	   
	}
}
